package cn.cutie.clotconfig.client.repository;

import cn.cutie.clotconfig.client.config.ConfigMeta;
import org.springframework.context.ApplicationContext;

import java.util.Map;

/**
 * @Description: 远程获取配置信息
 * @Author: Cutie
 * @CreateDate: 2024/5/10 22:09
 * @Version: 0.0.1
 */
public interface ClotRepository {
    static ClotRepository getDefault(ConfigMeta configMeta) {
        return new ClotRepositoryImpl(configMeta);
    }

    Map<String, String> getConfig();

//    interface ChangeListener {
//        void onChange(ChangeEvent changeEvent);
//    }
//
//    record ChangeEvent(ConfigMeta meta, Map<String, String> config) {}

    void addListener(ClotRepositoryChangeListener listener);
}
